using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.SqlClient;

using Antix;

namespace Antix.Data.Catalogue.Objects
{
    /// <summary>
    /// Database Schema
    /// </summary>
    public class DatabaseSchema : DatabaseObject
    {
        #region Constructor/Defaults

        /// <summary>
        /// Create a new schema
        /// </summary>
        /// <param name="server"></param>
        internal DatabaseSchema(Database database)
            : this("(new schema)", database) { base.IsNew = true; }

        /// <summary>
        /// Create an existing Schema object
        /// </summary>
        internal DatabaseSchema(string nameOriginal, Database database)
            : base(nameOriginal)
        {
            this.Database = database;
        }

        #endregion

        #region Properties

        #region Key

        /// <summary>
        /// Key for this object
        /// </summary>
        public override string Key
        {
            get { return this.Name; }
        }

        #endregion

        #region Database

        internal readonly Database Database;

        #endregion

        #endregion

        #region Methods

        #region Script the schema

        /// <summary>
        /// Generate script for this Schema
        /// </summary>
        /// <param name="sql">Sql</param>
        public override bool Script(StringBuilder sql, bool subObjects)
        {
            return this.Database.Script(this, sql, subObjects);
        }

        #endregion

        #endregion

    }
}
